<style type="text/css" media="screen">
.t_judul{
        
        padding:12px;
        font-size:16px;
        font-weight:bold;
        margin-bottom: 10px;
        padding-bottom: 20px;
}

.t_header{
        background:#dddddd;
        vertical-align: middle;
        padding:3px;
        text-align: center;
        border: solid 1px;
        font-weight: bold;
}

.t_isi{
        vertical-align: middle;
        padding:3px;
        border: solid 1px;
        font-weight: bold;
}

<!--
.container {min-width: 170px; margin: 0px auto;position: fixed; right: 0px; top: 0px;}
.messagebox {background-color: #F5F5F5;padding:0px;margin:0px;border: 1px solid #DBDBDB;}
.errorbox {color:#000;background-color:#f96d07;padding:5px;margin:10px 0px;border:1px solid #f27c7c;font-weight:bold;color:white;}
.confirmbox {background-color:#F2FFDB;color:#151515;border:1px solid #9C6;margin:10px 0px;padding:5px;}
-->
</style>

<div class="container">
<div class="messagebox" id="messageBox"></div>
</div>

<script>
$(function(){
        $('.d_weekly_holiday').click(function() {
                var jenis      = $(this).attr('jenis');
                var hari       = $(this).attr('vid');
                var nilai      = $(this).is(':checked');
                
                $.post(
                    '<?=base_url()?>index.php/holiday/saveWeeklyHoliday', 
                    {hari:hari,nilai:nilai,jenis:jenis},
                    function(data) {
                        if(data.status == 'OK'){
                                $("#messageBox").removeClass().addClass("errorbox").html(data.pesan).fadeIn(1000).fadeOut(6000);
                        }
                    },
                    "json"
                ).error(function() {
                    alert("-");
                });
        });
});

$(document).ready(function() {
	$("#messageBox").addClass("messagebox");setTimeout(function(){
		$("#messageBox").fadeOut("slow")}, 3000);
	});
function messagebox(){
	$("#messageBox").removeClass().addClass("confirmbox").html("Item has been saved").fadeIn(2000).fadeOut(6000);
}
function alertbox(){
	$("#messageBox").removeClass().addClass("errorbox").html("Oops, there was an error!").fadeIn(2000).fadeOut(6000);
}

</script>
<div class="box">
        <!-- box / title -->
        <div class="title">
                <h5>Weekly Holiday</h5>
                <ul class="links">
                        <li><a href="<?=base_url()."index.php/".$this->uri->segment(1)?>">Holiday</a></li>
                </ul>
        </div>
        <!-- end box / title -->
        
        <div class="table">
                <form id="form" name="form action="<?=$_SERVER['PHP_SELF']?>" method="post">
                <div class="form">
                        <div class="fields">
                                <div class="field">
                                        <div class="label" style="padding-top:0;">
                                                <label>Weekly Holiday Sales Ambassador:</label>
                                        </div>
                                        <div class="checkboxes">
                                                <label>
                                                        <?php
                                                        $days = $this->mservices->getValueFromTable('t_mtr_weekly_holiday',array('type'=>'sfa'));
                                                        foreach($days as $r){ ?>
                                                                <div class="checkbox"><input type=checkbox vid=1 id=sfa1 class=d_weekly_holiday jenis='sfa' <?=($r->d1 == 1?"checked":"")?> > <label for=sfa1>Sunday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=2 id=sfa2 class=d_weekly_holiday jenis='sfa' <?=($r->d2 == 1?"checked":"")?> > <label for=sfa2>Monday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=3 id=sfa3 class=d_weekly_holiday jenis='sfa' <?=($r->d3 == 1?"checked":"")?> > <label for=sfa3>Tuesday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=4 id=sfa4 class=d_weekly_holiday jenis='sfa' <?=($r->d4 == 1?"checked":"")?> > <label for=sfa4>Wednesday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=5 id=sfa5 class=d_weekly_holiday jenis='sfa' <?=($r->d5 == 1?"checked":"")?> > <label for=sfa5>Thrusday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=6 id=sfa6 class=d_weekly_holiday jenis='sfa' <?=($r->d6 == 1?"checked":"")?> > <label for=sfa6>Friday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=7 id=sfa7 class=d_weekly_holiday jenis='sfa' <?=($r->d7 == 1?"checked":"")?> > <label for=sfa7>Saturday</label></div>
                                                        <?php } ?>
                                                        &nbsp;
                                                </label>
                                        </div>
                                </div>
                                
                                <div class="field">
                                        <div class="label" style="padding-top:0;">
                                                <label>Weekly Holiday Direct Sales:</label>
                                        </div>
                                        <div class="checkboxes">
                                                <label>
                                                        <?php
                                                        $days = $this->mservices->getValueFromTable('t_mtr_weekly_holiday',array('type'=>'ds'));
                                                        foreach($days as $r){ ?>
                                                                <div class="checkbox"><input type=checkbox vid=1 id=ds1 class=d_weekly_holiday jenis='ds' <?=($r->d1 == 1?"checked":"")?> > <label for=ds1>Sunday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=2 id=ds2 class=d_weekly_holiday jenis='ds' <?=($r->d2 == 1?"checked":"")?> > <label for=ds2>Monday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=3 id=ds3 class=d_weekly_holiday jenis='ds' <?=($r->d3 == 1?"checked":"")?> > <label for=ds3>Tuesday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=4 id=ds4 class=d_weekly_holiday jenis='ds' <?=($r->d4 == 1?"checked":"")?> > <label for=ds4>Wednesday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=5 id=ds5 class=d_weekly_holiday jenis='ds' <?=($r->d5 == 1?"checked":"")?> > <label for=ds5>Thrusday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=6 id=ds6 class=d_weekly_holiday jenis='ds' <?=($r->d6 == 1?"checked":"")?> > <label for=ds6>Friday</label></div>
                                                                <div class="checkbox"><input type=checkbox vid=7 id=ds6 class=d_weekly_holiday jenis='ds' <?=($r->d7 == 1?"checked":"")?> > <label for=ds7>Saturday</label></div>
                                                        <?php } ?>
                                                        &nbsp;
                                                </label>
                                        </div>
                                </div>
                        </div>
                </div>
                </form>
        </div>
